﻿#pragma once

#include <string>
#include <vector>
namespace bz {

	class utils_string
	{
	public:
#ifdef WIN32
		static std::wstring ascii_unicode(const std::string & str);

		static std::string unicode_ascii(const std::wstring &wstr);

		static std::string ascii_utf8(const std::string & str);

		static std::string utf8_ascii(const std::string &utf8);

		static std::string  unicode_utf8(const std::wstring& wstr);

		static std::wstring utf8_unicode(const std::string& utf8);
#endif

		static void split(const std::string& s, std::vector<std::string>& tokens, const std::string& delimiters = ";");
		static std::vector<std::string> split(const std::string& s,  const std::string& delimiters);

		static bool contains(const std::string& str, const std::string& target);

		static void replace_all(std::string& str, const std::string& oldstr, const std::string& newstr);

		// 去除字符串开头的空白字符
		static std::string ltrim(const std::string& s);

		// 去除字符串末尾的空白字符
		static std::string rtrim(const std::string& s);

		// 去除字符串两端的空白字符
		static std::string trim(const std::string& s);


		static std::string fromLocal8(const char* str);

		static std::string generate_uuid();
	};

}